/*
 ============================================================================
 Page	     : 146
 Name        : trouble.c
 Date	     : 20210403
 Author      : Hbue 18060333
 Copyright   : Your copyright notice
 Description : 误用=会导致无限循环
 ============================================================================
 */

#include <stdio.h>

int main(void)
{
	long num = 0;
	long sum = 0L;

	printf("Please enter an integer to be summed ");
	printf("(q to quit): ");
	int status = scanf("%ld", &num);
	while(status = 1)
	{
		sum = sum + num;
		printf("Please enter next integer (q to quit): ");
		status = scanf("%ld",&num);
	}
	printf("Those integers sum to %ld.\n", sum);
	
	return 0;
}

